﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace Weight.Base
{
    [XmlTypeAttribute(AnonymousType = true)]
    [XmlRootAttribute(Namespace = "", IsNullable = false)]
    public   class BaseSetting
    {
        /// <summary>
        /// 当前配置版本号
        /// </summary>
        [XmlIgnore]
        public int CurrentVersion = 0;

        public Version XmlVersion;

        /// <summary>
        /// 版本控制
        /// </summary>
        public class Version
        {
            [XmlAttribute]
            /// <summary>
            /// 版本号
            /// </summary>
            public int VersionNO { get; set; }
            [XmlAttribute]
            /// <summary>
            /// 备注说明
            /// </summary>
            public string Memo = "当前配置文件版本";
            public Version()
            {
                VersionNO = 0;
            }
        }

        /// <summary>
        /// 公司名称配置
        /// </summary>
        public class Company
        {
            public Company()
            {
                CompanyName = "待配置";
                CompanyDescription = "河南郑州XXX软件服务公司";
            }

            [XmlText]
            public string CompanyName { set; get; }

            [XmlAttribute]
            public string Memo = "公司名称配置";

            [XmlAttribute]
            public string CompanyDescription { get; set; }

            public override string ToString()
            {
                return CompanyName == "待配置" ? "" : CompanyName;
            }
        }

        /// <summary>
        /// 是否自动登录
        /// </summary>
        public class AutoLogin
        {
            public AutoLogin()
            {
                IsAutoLogin = false;
                Account = "待配置";
                Pwd = "待配置";
            }

            /// <summary>
            /// 是否自动登录
            /// </summary>
            [XmlAttribute]
            public bool IsAutoLogin { get; set; }

            /// <summary>
            /// 记住密码
            /// </summary>
            [XmlAttribute]
            public bool IsRemeberPwd { get; set; }

            /// <summary>
            /// 账号
            /// </summary>
            [XmlAttribute]
            public string  Account { get; set; }

            /// <summary>
            /// 密码
            /// </summary>
            [XmlAttribute]
            public string Pwd { get; set; }
        }

        public virtual void setDefaultConfig() {

        }
    }
}
